<?php
require_once 'inc/global.inc.php';
require_once 'inc/keywords.inc.php';
if($_POST){
	include_once 'inc/functions.php';
	$action = $_POST['action'];
	if($_POST['action'] === 'check'){
		check_keywords($_POST['keywords']);
		return;
	}elseif($action === 'format'){
		format_keywords($_POST['keywords'], $_POST['format']);
		return;
	}elseif($action === 'unique'){
		unique_keywords($_POST['keywords'], $_POST['deep']);
		return;
	}elseif($action === 'download'){
		download($_POST);
		return;
	}
}
$configs = $_POST;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>关键词工具</title>
	<link href="css/style.css" type="text/css" rel="stylesheet" />
	<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
	<script type="text/javascript" src="js/jquery.cookie.js"></script>
	<script type="text/javascript" src="js/jquery.tabs.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
	<link href="css/slidingdoors/sliding-doors.css" type="text/css" rel="stylesheet" />
	
	<script type="text/javascript" src="js/fancybox/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
	<script type="text/javascript" src="js/fancybox/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="js/fancybox/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<style type="text/css">
header{
	margin-bottom:20px;
	margin-top:10px;
}
header h3{
	margin-right:5px;
	display:inline;
}
a{
	text-decoration:none;
	color:#000;
}
a:hover{
	text-decoration:underline;
}
#content{
	margin-left:10px;
	font-size:18px;
}
</style>
</head>
<body>
<div id="content">
<header>
        <h3><a href="makeKeyWords.php">关键词入库</a></h3>
        <h3><a href="findKeyWords.php">关键词查询</a></h3>
        <h3>关键词处理</h3>
        <hr>
    </header>	
<div class='keywords tools'>
<form action="" method="post" target="download_frame">
<?php
?>
<table align="center" width="1000">
	<col width="15%"/>
	<col width="40%"/>
	<col width="45%"/>
	<tr>
		<td>
			网站
		</td>
		<td>
			<input type="text" name="domain" value="www.youyi.com"/>
		</td>
		<td>会自动加http://,但不会自动加www</td>
	</tr>
	<tr>
		<td>
			页面
		</td>
		<td>
			<select multiple="multiple" name="pages[]" size="5">
				<option selected="selected">/</option>
				<option>/products_new.html</option>
				<option>/specials.html</option>
				<option>/products_all.html</option>
				<option>/site_map.html</option>
				<option>/featured_products.html</option>
			</select>
		</td>
		<td>可多选</td>
	</tr>
	<tr>
		<td>
			其它页面
		</td>
		<td>
			<textarea name="more_pages"></textarea>
		</td>
		<td>一行一个</td>
	</tr>
	<tr>
		<td>
			关键词
		</td>
		<td>
			<textarea name="keywords" style="height:250px;"></textarea>
		</td>
		<td>
			一行一个, 或者用符号 ;,| 分割<br/><br/>
			<input type="button" value="简单检查" onclick="check_keywords(this.form.keywords.value)"/><br/>
			<input type="button" value="移除重复" onclick="unique_keywords(this.form.keywords, false)"/>
			<input type="button" value="移除词序重复" onclick="unique_keywords(this.form.keywords, true)"/><br/>

			<input type="button" value="行分割" onclick="format_keywords(this.form.keywords, '\n')"/>
			<input type="button" value="逗号分割" onclick="format_keywords(this.form.keywords, ',')"/>
			<input type="button" value="Spinner" onclick="format_keywords(this.form.keywords,'spinner')"/>
			
		</td>
	</tr>
	<tr>
		<td>
			数量
		</td>
		<td>
			<input type="text" name="count"/>
		</td>
		<td>留空或者0以下会生成所有关键词和页面的匹配, 否则优先选择首页关键词, 其它页面随机获取</td>
	</tr>
	<tr>
		<td>
		</td>
		<td>
			<input type='hidden' name='action' value='download' />
			<input type='hidden' name='format' />
			<input type="submit" value="生成虫虫关键词" onclick='this.form.format.value="chongchong"'/>
			<input type="submit" value="生成链接" onclick='this.form.format.value="a"'/>
			<input type="submit" value="生成UBB" onclick='this.form.format.value="ubb"'/>
		</td>
		<td>
		</td>
	</tr>
</table>
</form>
<iframe width="100" height="100" name="download_frame" frameborder="0"></iframe>
</div>
</div>
</body>
</html>